home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / indent.vim < prev    next >
Encoding:
Text File  |  2001-08-27  |  4.5 KB  |  98 lines

  1. "  vim: set sw=4 sts=4:
  2. "  Maintainer    : Nikolai 'pcp' Weibull <da.box@home.se>
  3. "  URL        : http://www.pcppopper.org/
  4. "  Revised on    : Wed, 22 Aug 2001 20:48:04 +0200
  5. "  TODO        : is the deny-all (a la lilo.vim nice or no?)...
  6. "        : irritating to be wrong to the last char...
  7. "        : would be sweet if right until one char fails
  8.  
  9. if version < 600
  10.     syntax clear
  11. elseif exists("b:current_syntax")
  12.     finish
  13. endif
  14.  
  15. " Set iskeyword since we need `-' (and potentially others) in keywords.
  16. " For version 5.x: Set it globally
  17. " For version 6.x: Set it locally
  18. if version >= 600
  19.   command -nargs=1 SetIsk setlocal iskeyword=<args>
  20. else
  21.   command -nargs=1 SetIsk set iskeyword=<args>
  22. endif
  23. SetIsk 48-57,65-90,97-122,-,_
  24. delcommand SetIsk
  25.  
  26. " errors
  27. syn match   indentError "\S\+"
  28.  
  29. " comments
  30. syn region  indentComment matchgroup=indentComment start="/\*" end="\*/" contains=indentTodo
  31.  
  32. " todo
  33. syn keyword indentTodo contained TODO
  34.  
  35. " keywords (command-line switches)
  36. syn match   indentOptions "\<--\(no-\)\=blank-\(before-sizeof\|Bill-Shannon\|lines-\(after-\(commas\|declarations\|procedures\)\|before-block-comments\)\)\>"
  37. syn match   indentOptions "\<--brace-indent\s*\d\+\>"
  38. syn match   indentOptions "\<--braces-\(after\|on\)-\(if\|struct-decl\)-line\>"
  39. syn match   indentOptions "\<--break-\(\(after\|before\)-boolean-operator\|function-decl-args\)\>"
  40. syn match   indentOptions "\<--\(case\(-brace\)\=\|comment\|continuation\|declaration\|line-comments\|parameter\|paren\|struct-brace\)-indentation\s*\d\+\>"
  41. syn match   indentOptions "\<--\(no-\)\=comment-delimiters-on-blank-lines\>"
  42. syn match   indentOptions "\<--\(dont-\)\=cuddle-\(do-while\|else\)\>"
  43. syn match   indentOptions "\<--\(declaration-comment\|else-endif\)-column\s*\d\+\>"
  44. syn match   indentOptions "\<--dont-break-\(function-decl-args\|procedure-type\)\>"
  45. syn match   indentOptions "\<--\(dont-\)\=\(format\(-first-column\)\=\|star\)-comments\>"
  46. syn match   indentOptions "\<--\(honour\|ignore\)-newlines\>"
  47. syn match   indentOptions "\<--\(indent-level\|\(comment-\)\=line-length\)\s*\d\+\>"
  48. syn match   indentOptions "\<--\(leave\|remove\)-preprocessor-space\>"
  49. "not 100%, since casts\= should always be cast if no- isn't given
  50. syn match   indentOptions "\<--\(no-\)\=space-after-\(parentheses\|casts\=\|for\|if\|while\)\>"
  51. syn match   indentOptions "\<--\(dont-\)\=space-special-semicolon\>"
  52. syn match   indentOptions "\<--\(leave\|swallow\)-optional-blank-lines\>"
  53. syn match   indentOptions "\<--tab-size\s*\d\+\>"
  54. syn match   indentOptions "\<--\(no\|use\)-tabs\>"
  55. syn keyword indentOptions --gnu-style --ignore-profile --k-and-r-style --original
  56. syn keyword indentOptions --preserve-mtime --no-verbosity --verbose --output-file
  57. syn keyword indentOptions --no-parameter-indentation --procnames-start-lines
  58. syn keyword indentOptions --standard-output --start-left-side-of-comments
  59. syn keyword indentOptions --space-after-procedure-calls
  60. " this also here since the gnu indent fellas aren't consistent. (ever read
  61. " the code to `indent'? you'll know what i mean if you have)
  62. syn match   indentOptions "\<-\(bli\|cbi\|cd\|ci\|cli\|c\|cp\|di\|d\|i\|ip\|l\|lc\|pi\|sbi\|ts\)\s*\d\+\>"
  63. syn match   indentOptions "\<-T\s\+\w\+\>"
  64. syn keyword indentOptions --format-all-comments --continue-at-parentheses --dont-line-up-parentheses
  65. syn keyword indentOptions --no-space-after-function-call-names
  66. syn keyword indentOptions -bad -bap -bbb -bbo -bc -bfda -bl -br -bs -nbs -cdb -cdw -ce -cs -dce -fc1 -fca
  67. syn keyword indentOptions -gnu -hnl -kr -lp -lps -nbad -nbap -nbbb -nbbo -nbc -nbfda -ncdb -ncdw -nprs
  68. syn keyword indentOptions -nce -ncs -nfc1 -nfca -nhnl -nip -nlp -nlps -npcs -npmt -npro -npsl -nsaf -nsai
  69. syn keyword indentOptions -nsaw -nsc -nsob -nss -nv -o -orig -pcs -pmt -prs -psl -saf -sai -saw -sc
  70. syn keyword indentOptions -sob -ss -st -v -version -bls -brs -ut -nut
  71.  
  72. if exists("indent_minlines")
  73.     let b:indent_minlines = indent_minlines
  74. else
  75.     let b:indent_minlines = 50
  76. endif
  77. exec "syn sync minlines=" . b:indent_minlines
  78.  
  79. " Define the default highlighting.
  80. " For version 5.7 and earlier: only when not done already
  81. " For version 5.8 and later: only when an item doesn't have highlighting yet
  82. if version >= 508 || !exists("did_indent_syn_inits")
  83.     if version < 508
  84.     let did_indent_syn_inits = 1
  85.     command -nargs=+ HiLink hi link <args>
  86.     else
  87.     command -nargs=+ HiLink hi def link <args>
  88.     endif
  89.  
  90.     HiLink indentError        Error
  91.     HiLink indentComment    Comment
  92.     HiLink indentTodo        Todo
  93.     HiLink indentOptions    Keyword
  94.     delcommand HiLink
  95. endif
  96.  
  97. let b:current_syntax = "indent"
  98.